<script type="text/javascript">
$( function() {
	/*$('.unit').on('change', '.select', function(){
		var object = $( this );
		var id = $( this ).val();
		if( id == "" ) return;
		$.ajax({
			url : "{:U('UserRole/getRole')}",
			type : 'post',
			data : { id : id },
			dataType : 'json',
			success : function( data ){
				object.nextAll().remove();
				if ( data['status'] == 1 ) {
					if ( !data['info'] ) return;
					var data = data['info'];
					if( data.length > 0 ){
						object.removeAttr('name');
						object.removeClass('required');
						var html="<select class='select required' name='auth'>";
						html+="<option value=''>请选择</option>";
						for ( var i = 0; i < data.length; i++ ) {
							html+="<option value='"+ data[i].id +"'>"+ data[i].title +"</option>";
						}
						html+="</select>";
						//alert(html);
						object.parent().append(html);
					}
				}
			}
		});
	});*/
	var auth = {$dataInfo['auth']};
	var area = "{$dataInfo['area']}";
	if (auth == 15) {
		$.getJSON('__ROOT__/Public/Home/Js/data.js', function(data){
			var html = "";
			var obj = data['data'];
			for (var j in obj) {
				html += "<label class=\"label_auto\">";
				if ( area.indexOf( ","+ obj[j]['id'] +"," ) >= 0 ) {
					html += "	<input value=\"" + obj[j]['id'] + "\" name=\"area[]\" type=\"checkbox\" checked=\"checked\" />" + obj[j]['name'];
				} else {
					html += "	<input value=\"" + obj[j]['id'] + "\" name=\"area[]\" type=\"checkbox\" />" + obj[j]['name'];
				}
				html += "</label>";
			}
			$('.province').append(html);
			$(".areaBox").show();
		});
	}
} );
</script>
<style type="text/css">
.province
{width:auto; height:auto; overflow:hidden;}
.pageContent .pageFormContent .province .label_auto
{width:130px; text-align:left; float:left;}
</style>
<div class="pageContent">
    <form method="post" action="__URL__/update/" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
        <input type="hidden" name="id" value="{$dataInfo['id']}" />
        <div class="pageFormContent" layoutH="68">
        	<?php if($userAuth['id']==1){ ?>
			<div class="unit">
				<label>群组：</label>
				<select name="auth">
	                <option value="0">请选择</option>
	                <volist name="roleList" id="volist">
					<if condition="$volist['id'] == $dataInfo['auth']">
	                    <option value="{$volist['id']}" selected="selected">{$volist['title']}</option>
					<else />
						<option value="{$volist['id']}">{$volist['title']}</option>
					</if>
	                </volist>
	            </select>
			</div>
			<?php } ?>
			<div class="unit">
				<label>用户名：</label>
				<input type="text" name="username" value="{$dataInfo['username']}" class="required" />
			</div>
			<div class="unit">
				<label>职权描述：</label>
				<input type="text" name="nickname" value="{$dataInfo['nickname']}" class="required" />
			</div>
			<div class="unit areaBox" style="display:none;">
				<label>选择管辖区域：</label>
				<div class="province"></div>
			</div>
			<div class="unit">
				<label>描述：</label>
				<textarea name="intro" class="required">{$dataInfo['intro']}</textarea>
			</div>
			<div class="unit">
				<label>排　　序：</label>
				<input type="text" name="sort" value="{$dataInfo['sort']}" class="required" />
			</div>
			
        </div>
        <div class="formBar">
            <ul>
                     <li>
                        <div class="buttonSave">
                            <div class="buttonSaveContent">
                                <button type="submit">
                            		<i class="iconfont">&#xe644;</i>保存
                                </button>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="buttonCancel">
                            <div class="buttonCancelContent">
                                <button type="button" class="close">
                                	<i class="iconfont">&#xe640;</i>取消
                                </button>
                            </div>
                        </div>
                    </li>
            </ul>
        </div>
    </form>
</div>